﻿{include file="public/header"/}

<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i>
	首页 <span class="c-gray en">&gt;</span> 商品管理 <span class="c-gray en">&gt;</span> 商品分类列表
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
		<i class="Hui-iconfont">&#xe68f;</i>
	</a>
</nav>
<div class="page-container">
	<div class="text-c">
		<!--<input type="text" name="" id="" placeholder="标题名称" style="width:250px" class="input-text">-->
		<!--<button name="" id="" class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>-->
	</div>
	<div class="cl pd-5 bg-1 bk-gray mt-20">
		<span class="l">
			<a class="btn btn-primary radius" onclick="commodityCategoryAdd('添加商品分类','commodityCategoryAdd','','500','400')" href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 添加商品分类</a>
		</span>

	</div>
	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
			<thead>
			<tr class="text-c">
				<th width="25"><input type="checkbox" name="" value=""></th>
				<th width="80">编号</th>
				<th width="100">商品分类名称</th>
				<th width="100">添加时间</th>
				<th width="120">操作</th>
			</tr>
			</thead>
			<tbody>
			{volist name="data" id="vo"}
			<tr class="text-c">
				<td><input type="checkbox" value="1" name=""></td>
				<td>{$vo.id}</td>
				<td>{$vo.name}</td>
				<td>{$vo.create_time}</td>
				<!--<td class="td-status"><span class="label label-success radius">已启用</span></td>-->
				<td class="td-manage">
					<!--<a style="text-decoration:none" onClick="admin_stop(this,'10001')" href="javascript:;" title="停用">-->
					<!--<i class="Hui-iconfont">&#xe631;</i></a>-->
					<a title="修改商品分类名称" href="javascript:;" onclick="commodityCategoryEdit('修改商品分类名称','commodityCategoryEdit?id={$vo.id}','','500','400')" class="ml-5" style="text-decoration:none">
						<i class="Hui-iconfont">&#xe6df;</i>
					</a>
					<a title="删除" href="javascript:;" onclick="commodityCategoryDel(this,'{$vo.id}','')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
					<!--<a class="layui-btn layui-btn-mini layui-btn-danger" lay-event="del">删除</a>-->
				</td>
			</tr>
			{/volist}
			</tbody>
		</table>
	</div>
	<div class="pagin">

	</div>
</div>
{include file="public/footer"/}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__STATIC__/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
    $(function(){
        $('.table-sort').dataTable({
            "aaSorting": [[ 1, "desc" ]],//默认第几个排序
            "bStateSave": true,//状态保存
            "aoColumnDefs": [
                {"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
                // {"orderable":false,"aTargets":[0,5,6]}// 制定列不参与排序
            ]
        });

    });
    // $('.table-sort').dataTable({
    //     "aaSorting": [[ 1, "desc" ]],//默认第几个排序
    //     "bStateSave": true,//状态保存
    //     "pading":false,
    //     "aoColumnDefs": [
    //         //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
    //         {"orderable":false,"aTargets":[0,8]}// 不参与排序的列
    //     ]
    // });

    /*商品分类-添加*/
    function commodityCategoryAdd(title,url,w,h){
        layer_show(title,url,w,h);
    }
    // function article_add(title,url,w,h){
    //     var index = layer.open({
    //         type: 2,
    //         title: title,
    //         content: url
    //     });
    //     layer.full(index);
    // }
    /*商品分类-编辑*/
    function commodityCategoryEdit(title,url,w,h){
        layer_show(title,url,w,h);
    }
    // function article_edit(title,url,id,w,h){
    //     var index = layer.open({
    //         type: 2,
    //         title: title,
    //         content: url
    //     });
    //     layer.full(index);
    // }

    /*图片-删除*/
    function commodityCategoryDel(obj, id) {
        layer.confirm("确认要删除吗？", function (index) {
            $.ajax({
                type: 'POST',
                data:{"id":id},
                url: 'commodityCategoryDel',
                dataType: 'json',
                success: function(data){
                    if (data){
                        $(obj).parents("tr").remove();
                        layer.msg('已删除！',{icon:1,time:1000});
                        setTimeout('window.location.reload()',1000);
                    }
                    if (data.code == 403){
                        // $(obj).parents("tr").remove();
                        layer.msg('删除失败！',{icon:2,time:1000});
                        setTimeout('window.location.reload()',1000);
                        return false;
                    }

                },
            });
        });
    }
	
</script>
</body>
<style>
	/*分页样式*/
	.pagination{text-align:center;margin-top:20px;margin-bottom: 20px;}
	.pagination li{margin:0px 10px; border:1px solid #e6e6e6;padding: 3px 8px;display: inline-block;}
	.pagination .active{background-color: #46A3FF;color: #fff;}
	.pagination .disabled{color:#aaa;}
</style>
</html>